<template>
  <el-breadcrumb separator-class="el-icon-arrow-right" class="mr-5">
    <el-breadcrumb-item
      :to="{ path: `${item.path}` }"
      v-for="(item, i) of routeInfo"
      :key="i"
      >{{ item.meta.title }}</el-breadcrumb-item
    >
  </el-breadcrumb>
</template>
<script>
export default {
  data() {
    return {
      routeInfo: [],
    };
  },
  mounted() {
    this.routeInfo = this.$route.matched;
  },
  watch: {
    // 监视$route，当route发生改变时，更新页面内容
    $route() {
      this.routeInfo = this.$route.matched;
    },
  },
};
</script>